home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11523 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Determining the length of an int in string form
  5. Date: Sun, 24 Mar 96 21:35:45 GMT
  6. Organization: none
  7. Message-ID: <827703345snz@genesis.demon.co.uk>
  8. References: <3146D058.DD7@cbm.com> <4i7uth$qph@inet-nntp-gw-1.us.oracle.com> <DoE38u.GIH@iquest.net> <4in1ga$ogk@airdmhor.gen.nz> <Pine.SOL.3.91.960319172332.4535A-100000@darwin.UCSC.EDU> <314F65D3.6A8@oc.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <314F65D3.6A8@oc.com> lfw@oc.com "Larry Weiss" writes:
  15.  
  16. >I've seen some suggestions to try to fprintf() once to a file (maybe a 
  17. >"bit-bucket") to get a handle on how many characters sprintf() may use,
  18. >but I don't think that that's guaranteed by the C Standard to absolutely
  19. >correspond.
  20.  
  21. I think it must. 7.9.6.5:
  22.  
  23. "The sprintf function is equivalent to fprintf, except that the argument s
  24.  specifies an array into which the generated output is to be written,
  25.  rather than to a stream."
  26.  
  27. So the same number of characters are being written/output in both cases,
  28. unless a write error occurred in fprintf which you can detect.
  29.  
  30. -- 
  31. -----------------------------------------
  32. Lawrence Kirby | fred@genesis.demon.co.uk
  33. Wilts, England | 70734.126@compuserve.com
  34. -----------------------------------------
  35.